package com.k.kppcloud.modules.admin.controller;

import com.k.kppcloud.modules.admin.util.WebUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * index
 */
@Controller
public class IndexController {
    @Value("${spring.application.name}")
    private String appName;
    @Value("${server.port}")
    private Integer port;

    @GetMapping("/")
    public void index(HttpServletRequest request, HttpServletResponse response) {
        String msg = getAppName();
        WebUtils.writeOut(response, msg);
    }

    @GetMapping("/index")
    public void index2(HttpServletRequest request, HttpServletResponse response) {
        String msg = getAppName();
        WebUtils.writeOut(response, msg);
    }

    private String getAppName() {
        return appName + ":" + port;
    }

}
